import { Entity, Column, PrimaryGeneratedColumn, OneToMany, ManyToOne } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { Major } from 'src/modules/major/entities/major.entity';
import { BaseEntity } from 'src/common/entities/entities';
import { Teacher } from 'src/modules/teacher/entities/teacher.entity';
import { User } from 'src/modules/user/entities/user.entity';
import { SchoolStatus } from 'src/dictionaries/index.enum';



@Entity({ name: 'school' })
export class School extends BaseEntity {
  @ApiProperty({ example: 1, description: '学校ID' })
  @PrimaryGeneratedColumn()
  id: number;
  /** 学校名称 */
  @ApiProperty({ example: 'name', description: '学校名称' })
  @Column()
  name: string;
  /** 学校地址 */
  @ApiProperty({ example: 'address', description: '学校地址' })
  @Column()
  address: string;
  /** 学校简介 */
  @ApiProperty({ example: 'introduction', description: '学校简介' })
  @Column()
  introduction: string;
  /** 学校状态 */
  @ApiProperty({ enum: SchoolStatus, example: SchoolStatus.PENDING, description: '学校状态' })
  @Column({
    type: 'enum',
    enum: SchoolStatus,
    default: SchoolStatus.PENDING,
  })
  status: SchoolStatus;
  /** 校长姓名 */
  @ApiProperty({ example: 'principalName', description: '校长姓名' })
  @Column({
    nullable: true
  })
  principalName: string;
  /** 校长邮箱 */
  @ApiProperty({ example: 'principalEmail', description: '校长邮箱' })
  @Column({
    nullable: true
  })
  principalEmail: string;

  /** 专业 */
  // @ApiProperty({ example: '学校专业', description: '学校专业列表' })
  // @OneToMany(() => Major, major => major.school)
  // majors: Major[];
  // /** 教师信息 */
  // @ApiProperty({ example: '教师信息', description: '教师列表' })
  // @OneToMany(() => Teacher, teacher => teacher.school)
  // teachers: Teacher[];
  /** 学校用户 */
  // @ApiProperty({ example: '学校用户', description: '学校用户列表' })
  // @OneToMany(() => User, user => user.school)
  // users: User[];

  /** 创建人 */
  @ApiProperty({ example: 'createById', description: '创建人' })
  @Column({ type: 'int', comment: '创建人' })
  createById: number;
  /** 更新人 */
  @ApiProperty({ example: 'updateById', description: '更新人' })
  @Column({ type: 'int', comment: '更新人', nullable: true })
  updateById: number;
}
